package com.demo2do.mobile.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.demo2do.mobile.web.interceptor.MobileDetect;
import com.demo2do.mobile.web.interceptor.Router;
import com.demo2do.mobile.web.interceptor.WechatAuthority;

/**
 * 
 * @author mohanlan
 *
 */
@Controller
@RequestMapping("/")
public class HomeController {
    
    /**
     * Index page
     * 
     * @return
     */
    @RequestMapping("")
    @Router(targetUrl = "http://www.baidu.com")
    @WechatAuthority(targetUrl = "/weixin-required")
    @MobileDetect()
    public String index() {
        return "index";
    }
    
    /**
     * userinfo test page
     * @return
     */
    @RequestMapping("/userinfo-test")
    @WechatAuthority(targetUrl = "/weixin-required")
    @MobileDetect()
    public String userinfo() {
        return "userinfo";
    }
    
    /**
     * Weixin required
     * 
     * @return
     */
    @RequestMapping("/weixin-required")
    @Router(targetUrl = "http://www.baidu.com")
    public String weixin() {
        return "weixin-required";
    }
    
    /**
     * Login pages
     * 
     * @return
     */
    @RequestMapping("/login")
    public String login() {
        return "auth/login";
    }
}
